<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我是转换</title>
</head>
<body>
<div class="wrap">
    我是转换
    <p>token: <span id="tokenSpan"></span></p>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script>
  function getQueryString(name, url) {
    if (!url) url = window.location.href
    name = name.replace(/[\[\]]/g, '\\$&')
    const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)')
    const results = regex.exec(url)
    if (!results) return null
    if (!results[2]) return ''
    return decodeURIComponent(results[2].replace(/\+/g, ' '))
  }
  // const INDEX = 'http://q-penn.test.com:8888/tran/a.html'
  // const INDEX = 'http://127.0.0.1:8888/tran/a.html'
  const INDEX = 'https://jipengju.gitee.io/tripartite/tran/a.html'
  const tk = getQueryString('tk')
  if(tk) {
    document.getElementById('tokenSpan').innerText = tk
    Cookies.set('QUECTEL-TK', tk, { expires: 7, path: '', domain: 'gitee.io' })
    location.href = INDEX
  }
</script>
</html>
